<template>
	<van-list
	  v-model="loading"
	  :finished="finished"
	  :finished-text="i18n.common.no_more"
	  :loading-text="i18n.common.loading"
	  @load="onLoad2"
	>
		<view class="cu-list menu-avatar">
			<view v-for="(item,index) in fightRecordList" :key="index" class="cu-item">
				<view 
					@click="goHistoryList(item)"
					class="cu-avatar round lg"
					:style="'background-image:url('+item.user_header+');'"
				>
				</view>
				<view class="content">
					<view class="text-grey" style="font-size: 12px">
						{{item.nick_name}}
					</view>
					<view class="text-gray text-sm flex">
						<view class="text-cut f10">
							<!-- <text class="cuIcon-infofill text-red  margin-right-xs"></text> -->
							{{item.fight_time}}
						</view>
					</view>
				</view>
				<view class="d-flex d-flex-2" >
					<view class="font-md px-1 f12 text-gray">{{item.count_num}}{{i18n.common.ci}}</view>
					<!-- <van-icon class="py-1" name="arrow" /> -->
					
					<van-button type="warning" size="mini" class="f10 look-btn" @click="showDrawer('showRight',item)">
						<!-- 查看 -->
						{{i18n.home_page.good_details.t47}}
					</van-button>
				</view>
			</view>
		</view>
	</van-list>
</template>

<script>
	
	import {
		getFightRecordList
	} from '@/api/lottery.js';
	
	export default{
		props:['goods_fight_id'],
		data(){
			return{
				//当前页码数
				currentPage:1,
				loading: false,
				finished: false,
				//抽奖列表信息
				fightRecordList:[]
			}
		},
		computed: {
			i18n() {
				return this.$t("index")
			}
		},
		methods:{
			onLoad2() {
				let data={goods_fight_id:this.goods_fight_id,page:this.currentPage,limitNum:8};
				let that=this;
				getFightRecordList(data).then(res=>{
					that.loading = false;
					if(res == undefined || res.length <= 0){
						 that.finished=true;
						 return;
					}
					res.forEach(item=>{
						that.fightRecordList.push(item);
					})
					that.currentPage=that.currentPage+1;
				});
			},
			showDrawer(s,data){
				let json={status:s,item:data};
				this.$emit("showDrawer",json);
			},
			goHistoryList(item){
				uni.navigateTo({
					url:"/pages/lottery/historyDetail/historyDetail?uid="+item.user_id+"&user_header="+item.user_header+
					"&nick_name="+item.nick_name+"&user_ip_address="+item.user_ip_address
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
@import "@/common/font.css";
.cu-item{
	// border-bottom: 0.5px solid #ccc;
	border-bottom: 0.5px solid #f7f8fa;
}
.look-btn{
	margin-right: 13px;
}
.d-flex-2{
	align-items: center;
}
</style>
